package com.huasan.www.demon.data.service.impl;
import com.huasan.www.demon.util.OnePage;
import com.huasan.www.demon.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.huasan.www.demon.data.dao.FeedbackMapper;
import com.huasan.www.demon.data.service.FeedbackService;

import com.huasan.www.demon.pojo.Feedback;
import com.huasan.www.demon.pojo.FeedbackExample;
import com.huasan.www.demon.pojo.FeedbackWithBLOBs;
import java.util.List;
import org.apache.ibatis.annotations.Param;

@Service("feedbackService")
public class FeedbackServiceImpl implements FeedbackService{
	
    @Autowired
    private FeedbackMapper feedbackDao;    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table feedback
     *
     * @mbggenerated Sun Mar 23 21:46:25 CST 2014
     */
    public int countByExample(FeedbackExample example){
      return feedbackDao.countByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table feedback
     *
     * @mbggenerated Sun Mar 23 21:46:25 CST 2014
     */
    public int deleteByExample(FeedbackExample example){
      return feedbackDao.deleteByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table feedback
     *
     * @mbggenerated Sun Mar 23 21:46:25 CST 2014
     */
    public int deleteByPrimaryKey(Long id){
      return feedbackDao.deleteByPrimaryKey(id);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table feedback
     *
     * @mbggenerated Sun Mar 23 21:46:25 CST 2014
     */
    public int insert(FeedbackWithBLOBs record){
      return feedbackDao.insert(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table feedback
     *
     * @mbggenerated Sun Mar 23 21:46:25 CST 2014
     */
    public int insertSelective(FeedbackWithBLOBs record){
      return feedbackDao.insertSelective(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table feedback
     *
     * @mbggenerated Sun Mar 23 21:46:25 CST 2014
     */
    public List<FeedbackWithBLOBs> selectByExampleWithBLOBs(FeedbackExample example){
      return feedbackDao.selectByExampleWithBLOBs(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table feedback
     *
     * @mbggenerated Sun Mar 23 21:46:25 CST 2014
     */
    public List<Feedback> selectByExample(FeedbackExample example){
      return feedbackDao.selectByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table feedback
     *
     * @mbggenerated Sun Mar 23 21:46:25 CST 2014
     */
    public FeedbackWithBLOBs selectByPrimaryKey(Long id){
      return feedbackDao.selectByPrimaryKey(id);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table feedback
     *
     * @mbggenerated Sun Mar 23 21:46:25 CST 2014
     */
    public int updateByExampleSelective(@Param("record") FeedbackWithBLOBs record, @Param("example") FeedbackExample example){
      return feedbackDao.updateByExampleSelective(record,example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table feedback
     *
     * @mbggenerated Sun Mar 23 21:46:25 CST 2014
     */
    public int updateByExampleWithBLOBs(@Param("record") FeedbackWithBLOBs record, @Param("example") FeedbackExample example){
      return feedbackDao.updateByExampleWithBLOBs(record,example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table feedback
     *
     * @mbggenerated Sun Mar 23 21:46:25 CST 2014
     */
    public int updateByExample(@Param("record") Feedback record, @Param("example") FeedbackExample example){
      return feedbackDao.updateByExample(record,example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table feedback
     *
     * @mbggenerated Sun Mar 23 21:46:25 CST 2014
     */
    public int updateByPrimaryKeySelective(FeedbackWithBLOBs record){
      return feedbackDao.updateByPrimaryKeySelective(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table feedback
     *
     * @mbggenerated Sun Mar 23 21:46:25 CST 2014
     */
    public int updateByPrimaryKeyWithBLOBs(FeedbackWithBLOBs record){
      return feedbackDao.updateByPrimaryKeyWithBLOBs(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table feedback
     *
     * @mbggenerated Sun Mar 23 21:46:25 CST 2014
     */
    public int updateByPrimaryKey(Feedback record){
      return feedbackDao.updateByPrimaryKey(record);
    }

    public OnePage<Feedback> selectOnePageByExample(FeedbackExample example){
    	int count = feedbackDao.countByExample(example);
    	List<Feedback> dataList = feedbackDao.selectByExample(example);
    	OnePage<Feedback> onepage = new OnePage<Feedback>();
    	onepage.setPage(new Page(example.getLimitStart(), example.getLimitEnd()));
    	onepage.getPage().setCount(count);
    	onepage.setDataList(dataList);
    	return onepage;
    }

	@Override
	public OnePage<FeedbackWithBLOBs> selectOneBlobPageByExample(
			FeedbackExample example) {
		int count = feedbackDao.countByExample(example);
    	List<FeedbackWithBLOBs> dataList = feedbackDao.selectByExampleWithBLOBs(example);
    	OnePage<FeedbackWithBLOBs> onepage = new OnePage<FeedbackWithBLOBs>();
    	onepage.setPage(new Page(example.getLimitStart(), example.getLimitEnd()));
    	onepage.getPage().setCount(count);
    	onepage.setDataList(dataList);
		return onepage;
	}
}